package com.jiazhong.listener;

import javax.servlet.ServletRequestAttributeEvent;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.annotation.WebListener;

//@WebListener
public class 请求容器操作监听 implements ServletRequestAttributeListener {
    @Override
    public void attributeAdded(ServletRequestAttributeEvent e) {
        System.out.println("向request容器中添加了," + e.getName() + ",值是：" + e.getValue());
    }

    @Override
    public void attributeRemoved(ServletRequestAttributeEvent e) {
        System.out.println("删除了request容器中的" + e.getName() + ",原来的值是" + e.getValue());
    }

    @Override
    public void attributeReplaced(ServletRequestAttributeEvent e) {
        System.out.println("修改了request容器中" + e.getName()
                + "的值，原来的值是：" + e.getValue() + "，新值是："
                + e.getServletRequest().getAttribute(e.getName()));
    }
}
